import wepy from 'wepy'

export const getMoments = (page = 1, size = 5) => wepy.request(`/moment/my?page=${page}&size=${size}`)

export const getMoment = id => wepy.request(`/moment/${id}`)

export const getComments = (id, page = 1, size = 520) => wepy.request(`/moment/comment/${id}?page=${page}&size=${size}`)

export const commentdetail = id => wepy.request(`/topic/commentdetail/${id}`)

export const commentList = id => wepy.request(`/topic/commentdetail_comment/${id}`)

export const ReWriteMoment = (id, type) => wepy.request(`/moment/edit/${id}/type/${type}`)

export const inspiration = () => wepy.request(`/moment/linggan`)

export const sendSure = data => wepy.request({
  url: '/discuss/like',
  method: 'POST',
  data
})

export const getTags = () => wepy.request('/moment/tag')

export const sendTalk = data => wepy.request({
  method: 'POST',
  url: '/discuss',
  data
})

export const getTalkList = (id, page = 1, size = 6) => wepy.request(`/discuss/getDiscuss/${id}?page=${page}&size=${size}`)

export const getTalkDetail = id => wepy.request(`/discuss/detail/${id}`)

export const getBestDiary = (page = 1, size = 6) => wepy.request(`/moment/selected?page=${page}&size=${size}`)

export const storeUnSendMoment = data => wepy.request({
  method: 'POST',
  url: '/moment/saveDraft',
  data
})

export const getUnSendMoment = () => wepy.request(`/moment/editDraft/type/moment`)

export const getMomentAllNumber = id => wepy.request(`/moment/getCourseInfoByLessonId/${id}`)

export const EditorMoment = data => wepy.request({
  method: 'POST',
  url: '/moment/editUpdateDraft',
  data
})

export const getQrcode = token => wepy.request(`https://api.weixin.qq.com/cgi-bin/wxaapp/createwxaqrcode?access_token=${token}`)

export const getAboutMoments = (id, page = 1, size = 6) => wepy.request(`/moment/selectedByUid?id=${id}&page=${page}&size=${size}`)

export const checkLookNumber = id => wepy.request(`/moment/checkClockView/${id}`)

export const getBooks = (key, page = 0, size = 6) => wepy.request(`/moment/book?key=${key}&tag=儿童&page=${page}&size=${size}`)

export const getHistorBooks = () => wepy.request(`/moment/getBook`)

export const getUserMoment = (id, page = 1, size = 10) => wepy.request(`/user/getList/${id}?page=${page}&size=${size}`)

export const reEditoreMoment = data => wepy.request({
  method: 'POST',
  url: '/moment/edit',
  data
})

export const deleteMoment = data => wepy.request({
  method: 'POST',
  url: '/moment/delete',
  data
})

export const getMomentSee = data => wepy.request({
  url: '/user/follow',
  method: 'POST',
  data
})

export const submitMoment = data => wepy.request({
  url: '/moment',
  method: 'POST',
  data
})

export const submitComment = data => wepy.request({
  url: '/moment/discuss',
  method: 'POST',
  data
})

export const like = data => wepy.request({
  url: '/moment/like',
  method: 'POST',
  data
})
